<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>Ricerca del Pacchetto</title>
 	<link href="resources/css/main.css" rel="stylesheet" type="text/css" /> 
</h:head>
<h:body>
<header>
		<a><h:link class="logo" outcome="index" /></a>
	</header>
<div id="container">
	<div id="content1">
			<div id="contentLarge">
		<h:form id="form" onsubmit="#{Retriever.trovaPacchetti()}">
	
				<p:growl id="messages" showDetail="true"/>
				
				<p:dataTable id="dataTable" var="pacchetti" value="#{Retriever.listaPacchetti}" widgetVar="pacchettiTable"   
		            emptyMessage="Nessun pacchetto trovato per i parametri specificati." filteredValue="#{Retriever.pacchettiFiltrati}" rowKey="#{pacchetti.idPacchetto}"
		            editable="true">
		            
		            
		  		<f:facet name="header">
          			 Cerca, modifica ed elimina pacchetti 
        		</f:facet> 
        		
        		<p:ajax event="rowEdit" listener="#{beanPacchetto.editPacchetto}" update=":form:messages" />  
       			<p:ajax event="rowEditCancel" listener="#{beanPacchetto.cancelPacchetto}" update=":form:messages" />
		  
		  		
		  		
		        <p:column id="nomeColumn" filterBy="nome"   
		                headerText="Nome"
		                filterMatchMode="contains">  
		            <p:cellEditor>  
                		<f:facet name="output">  
                    		<h:outputText value="#{pacchetti.nome}" />  
                		</f:facet>  
                		<f:facet name="input">  
                    		<p:inputText value="#{pacchetti.nome}"/>
                		</f:facet>  
            		</p:cellEditor>  
		        </p:column>  
		  
		        <p:column id="descrizioneColumn" filterBy="descrizione"  
		                headerText="Descrizione"
		                filterMatchMode="contains">
		                <p:cellEditor>  
                		<f:facet name="output">  
		            		<h:outputText value="#{pacchetti.descrizione}" />  
                		</f:facet>  
                		<f:facet name="input">  
                    		<p:inputText value="#{pacchetti.descrizione}" style="width:100%"/>
                		</f:facet>  
            		</p:cellEditor> 
		        </p:column>  
		        
		        <p:column style="width:6%">  
           			<p:rowEditor />  
        		</p:column>
        		
        		<p:column headerText="Modifica prodotti base" style="width:6%">  
           			<p:commandButton id="selectButton" icon="ui-icon-search" title="View" action="modificaPacchetto">  
                		<f:setPropertyActionListener value="#{pacchetti}" target="#{Retriever.pacchettoSelezionato}" />  
           			</p:commandButton>  
        		</p:column>
		          
		    </p:dataTable> 
		    
	</h:form>
        </div>
        </div>
        </div>
	<h:outputStylesheet library="css" name="main.css"/>
</h:body>
</html>